home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / shaw / vbits32 / vbits32.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  3.8 KB  |  153 lines

  1. // vbits32.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vbits32.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "vbitsdoc.h"
  9. #include "vbitsvw.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CVbits32App
  18.  
  19. BEGIN_MESSAGE_MAP(CVbits32App, CWinApp)
  20.     //{{AFX_MSG_MAP(CVbits32App)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG_MAP
  25.     // Standard file based document commands
  26.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  27.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  28.     // Standard print setup command
  29.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CVbits32App construction
  34.  
  35. CVbits32App::CVbits32App()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CVbits32App object
  43.  
  44. CVbits32App theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CVbits32App initialization
  48.  
  49. BOOL CVbits32App::InitInstance()
  50. {
  51.     // Standard initialization
  52.     // If you are not using these features and wish to reduce the size
  53.     //  of your final executable, you should remove from the following
  54.     //  the specific initialization routines you do not need.
  55.  
  56.     Enable3dControls();
  57.  
  58.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  59.  
  60.     // Register the application's document templates.  Document templates
  61.     //  serve as the connection between documents, frame windows and views.
  62.  
  63.     CMultiDocTemplate* pDocTemplate;
  64.     pDocTemplate = new CMultiDocTemplate(
  65.         IDR_VBIT32TYPE,
  66.         RUNTIME_CLASS(CVbits32Doc),
  67.         RUNTIME_CLASS(CMDIChildWnd),          // standard MDI child frame
  68.         RUNTIME_CLASS(CVbits32View));
  69.     AddDocTemplate(pDocTemplate);
  70.  
  71.     // create main MDI Frame window
  72.     CMainFrame* pMainFrame = new CMainFrame;
  73.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  74.         return FALSE;
  75.     m_pMainWnd = pMainFrame;
  76.  
  77.     // Enable DDE Execute open
  78.     EnableShellOpen();
  79.     RegisterShellFileTypes();
  80.  
  81.     // simple command line parsing
  82.     if (m_lpCmdLine[0] == '\0')
  83.     {
  84.         // create a new (empty) document
  85.         OnFileNew();
  86.     }
  87.     else
  88.     {
  89.         // open an existing document
  90.         OpenDocumentFile(m_lpCmdLine);
  91.     }
  92.  
  93.     // Enable drag/drop open
  94.     m_pMainWnd->DragAcceptFiles();
  95.  
  96.     // The main window has been initialized, so show and update it.
  97.     pMainFrame->ShowWindow(m_nCmdShow);
  98.     pMainFrame->UpdateWindow();
  99.  
  100.     return TRUE;
  101. }
  102.  
  103. /////////////////////////////////////////////////////////////////////////////
  104. // CAboutDlg dialog used for App About
  105.  
  106. class CAboutDlg : public CDialog
  107. {
  108. public:
  109.     CAboutDlg();
  110.  
  111. // Dialog Data
  112.     //{{AFX_DATA(CAboutDlg)
  113.     enum { IDD = IDD_ABOUTBOX };
  114.     //}}AFX_DATA
  115.  
  116. // Implementation
  117. protected:
  118.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  119.     //{{AFX_MSG(CAboutDlg)
  120.         // No message handlers
  121.     //}}AFX_MSG
  122.     DECLARE_MESSAGE_MAP()
  123. };
  124.  
  125. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  126. {
  127.     //{{AFX_DATA_INIT(CAboutDlg)
  128.     //}}AFX_DATA_INIT
  129. }
  130.  
  131. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  132. {
  133.     CDialog::DoDataExchange(pDX);
  134.     //{{AFX_DATA_MAP(CAboutDlg)
  135.     //}}AFX_DATA_MAP
  136. }
  137.  
  138. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  139.     //{{AFX_MSG_MAP(CAboutDlg)
  140.         // No message handlers
  141.     //}}AFX_MSG_MAP
  142. END_MESSAGE_MAP()
  143.  
  144. // App command to run the dialog
  145. void CVbits32App::OnAppAbout()
  146. {
  147.     CAboutDlg aboutDlg;
  148.     aboutDlg.DoModal();
  149. }
  150.  
  151. /////////////////////////////////////////////////////////////////////////////
  152. // CVbits32App commands
  153.